<form lay-filter="supplierInfoForm" id="supplierInfoForm" class="layui-form model-form supplierInfoForm">
    <input name="id" type="hidden"/>
    <div class="layui-form-item layui-row">
        <div class="layui-col-md4">
            <label class="layui-form-label">公司名称</label>
            <div class="layui-input-block">
                <input name="corporateName" placeholder="请输入供应商公司名称" type="text" class="layui-input"
                       lay-verify="required" required autocomplete="off"/>
            </div>
        </div>
        <div class="layui-col-md4" id="code">
            <label class="layui-form-label">供应商编码</label>
            <div class="layui-input-block">
                <input name="code" placeholder="请输入供应商编码" type="text" class="layui-input" autocomplete="off"/>
            </div>
        </div>
        <div class="layui-col-md4" style="display: flex;">
            <label class="layui-form-label">供应商级别</label>
            <div class="layui-input-block" style="margin: 0 10px 0 0; flex: 1;">
                <select name="levelId" lay-verify="required" required id="levelId"></select>
            </div>
            <!--        <div class="layui-form-mid layui-word-aux" style="margin-right: 0;">-->
            <!--          <a href="#/purchase/supplierLevel" class="layui-btn layui-btn-xs" ew-event="closeDialog">-->
            <!--            <i class="layui-icon layui-icon-addition"></i>-->
            <!--          </a>-->
            <!--        </div>-->
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-col-md4">
            <label class="layui-form-label">供应商分类</label>
            <div class="layui-input-block">

                <select name="categoryId" id="categoryId" lay-filter="categoryId"
                ></select>
            </div>
            <!--        <input name="categoryId" type="hidden" lay-verify="categoryId" lay-verify="required"/>-->
            <!--        <div class="layui-input-block" id="selectCategory" style="margin: 0 10px 0 0; flex: 1;">-->
            <!--        </div>-->
            <!--        <div class="layui-form-mid layui-word-aux" style="margin-right: 0;">-->
            <!--          <a href="#/purchase/supplierCategory" class="layui-btn layui-btn-xs" ew-event="closeDialog">-->
            <!--            <i class="layui-icon layui-icon-addition"></i>-->
            <!--          </a>-->
            <!--        </div>-->
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">证件号码</label>
            <div class="layui-input-block">
                <input name="certificateNumber" placeholder="请输入证件号码" type="text" class="layui-input"
                       autocomplete="off"/>
            </div>
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">营业执照</label>
            <div class="layui-input-block">
                <!--          <div id="btnUploadCredentials_path" class="uploadImgStyle"></div>-->
                <!--          <div id="btnUploadCredentials" class="layui-btn" style="float: left;"><i class="layui-icon">&#xe681;</i>上传-->
                <!--          </div>-->
                <img id="certificateSrc" style="width: 100px" />
                <input name="certificatePic" type="hidden" class="layui-input" lay-verify="" id="certificatePic"/>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-col-md4">
            <label class="layui-form-label">收款银行</label>
            <div class="layui-input-block">
                <input name="bankName" placeholder="请输入收款银行" type="text" class="layui-input" autocomplete="off"
                />
            </div>
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">收款银行账户</label>
            <div class="layui-input-block">
                <input name="bankAccount" placeholder="请输入收款银行账户" type="text" class="layui-input"
                       autocomplete="off"
                />
            </div>
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">收款银行账号</label>
            <div class="layui-input-block">
                <input name="bankNumber" placeholder="请输入收款银行账号" type="text" class="layui-input"
                       autocomplete="off"
                />
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">开户许可证</label>
        <div class="layui-input-block">
<!--            <div id="btnUploadDviceAppendix_path" class="uploadImgStyle"></div>-->
<!--            <div id="btnUploadDviceAppendix" class="layui-btn" style="float: left;"><i-->
<!--                    class="layui-icon">&#xe681;</i>上传-->
<!--            </div>-->
            <img id="openingPermitSrc" style="width: 100px"/>
            <input name="openingPermitPic" type="hidden" class="layui-input" lay-verify="" id="openingPermitPic"/>
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-col-md4">
            <label class="layui-form-label">省</label>
            <div class="layui-input-block">
                <select name="provinceId" id="provinceId" lay-filter="provinceId"
                ></select>
            </div>
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">市</label>
            <div class="layui-input-block">
                <select name="cityId" id="cityId" lay-filter="cityId"></select>
            </div>
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">区/县</label>
            <div class="layui-input-block">
                <select name="areaId" id="areaId" lay-filter="areaId"></select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系地址</label>
        <div class="layui-input-block">
            <input name="contactAddress" placeholder="请输入联系地址" type="text" class="layui-input" autocomplete="off"
            />
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-col-md4">
            <label class="layui-form-label">业务联系人</label>
            <div class="layui-input-block">
                <input name="businessContact" placeholder="请输入业务联系人" type="text" class="layui-input"
                       autocomplete="off"
                />
            </div>
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">财务联系人</label>
            <div class="layui-input-block">
                <input name="financialContact" placeholder="请输入财务联系人" type="text" class="layui-input"
                       autocomplete="off"
                />
            </div>
        </div>
        <div class="layui-col-md4">
            <label class="layui-form-label">法定代表人</label>
            <div class="layui-input-block">
                <input name="legalPerson" placeholder="请输入法定代表人" type="text" class="layui-input"
                       autocomplete="off"
                />
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注描述</label>
        <div class="layui-input-block">
            <input name="remark" placeholder="请输入备注描述" type="text" class="layui-input" autocomplete="off"/>
        </div>
    </div>
    <div class="layui-form-item text-right">
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog" id="cancel">关闭</button>
        <button class="layui-btn" lay-filter="supplierInfoFormSubmit" lay-submit id="supplierInfoFormSubmit">保存
        </button>
    </div>
</form>
<script>
    layui.use(['layer', 'form', 'table', 'admin', 'laydate', 'upload', 'laytpl'], async function () {
        var form = layui.form;
        var admin = layui.admin;
        var $ = layui.jquery;
        const nowData = {...parentData}
        const data = nowData.data
        admin.setFormDisable('#supplierInfoForm', true)
        await admin.initDataSelectPro('enterprisecab/area/admin/area/getProvince', {}, 'provinceId')
        await admin.initDataSelectPro('enterprisecab/area/admin/area/getCity', {parentId: data.supplierInfo.provinceId}, 'cityId')
        await admin.initDataSelectPro('enterprisecab/area/admin/area/getArea', {parentId: data.supplierInfo.cityId}, 'areaId')
        await admin.initDataSelectPro('enterprise/purchase/admin/supplierLevel/list', {limit: 99999}, 'levelId')
        await admin.initDataSelectPro('enterprise/purchase/admin/supplierCategory/list', {limit: 99999}, 'categoryId')

        // admin.reqSync('enterprisecab/area/admin/area/getProvince', {}, function (res) {
        //   if (200 == res.code) {
        //     loadSelectHtml(res.data, "请选择省份", "provinceId", 0);
        //   }
        // }, 'GET', true);
        // admin.reqSync('enterprisecab/area/admin/area/getCity?parentId=' + data.provinceId, {}, function (res) {
        //   if (200 == res.code) {
        //     loadSelectHtml(res.data, "请选择城市", "cityId", 0);
        //   }
        // }, 'GET', true);
        // admin.reqSync('enterprisecab/area/admin/area/getArea?parentId=' + data.cityId, {}, function (res) {
        //   if (200 == res.code) {
        //     loadSelectHtml(res.data, "请选择区/县", "areaId", 0);
        //   }
        // }, 'GET', true);
        console.log(
            'nowData.supplierInfo', data.supplierInfo
        )
        form.val('supplierInfoForm', data.supplierInfo)
        $('#certificateSrc').attr('src',data.supplierInfo.certificatePic)
        $('#openingPermitSrc').attr('src',data.supplierInfo.openingPermitPic)

    })

</script>